﻿using UnityEngine;
using System.Collections;

public class GraphInit : MonoBehaviour {
    public Texture lightMap;
    public Vector3 camPos = Vector3.zero;
    //public float camSize = 10;
    public Vector3 ambient = Vector3.one;
    public Texture lightMask;
    public float lightCoff;
    void Awake() {
        var lc = GameObject.FindGameObjectWithTag("LightCamera").camera;
        var camSize = lc.orthographicSize;

        Shader.SetGlobalTexture("_LightMap", lightMap);
        Shader.SetGlobalVector("_CamPos", camPos);
        Shader.SetGlobalFloat("_CameraSize", camSize);
        //var cameraX = Screen.width*1.0f/Screen.height*camSize;
        //var cameraX = camSize;

        //Shader.SetGlobalFloat("_CameraSizeX", cameraX);

        Shader.SetGlobalVector("_AmbientCol", ambient);
        Shader.SetGlobalTexture("_LightMask", lightMask);
        Shader.SetGlobalFloat("_LightCoff", lightCoff);
    }


    public Color testAmbient;
    [ButtonCallFunc()]
    public bool InitAmbient;
    public void InitAmbientMethod() {
        Shader.SetGlobalVector("_AmbientCol", testAmbient);
    }
}
